FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
WORKDIR /app
EXPOSE 4651
EXPOSE 44365

FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /src
COPY Lonewolf.WebApp/Lonewolf.WebApp.csproj Lonewolf.WebApp/
COPY Lonewolf.Service/Lonewolf.Service.csproj Lonewolf.Service/
COPY Lonewolf.IService/Lonewolf.IService.csproj Lonewolf.IService/
COPY Lonewolf.Infrastructure/Lonewolf.Infrastructure.csproj Lonewolf.Infrastructure/
COPY Lonewolf.Entity/Lonewolf.Entity.csproj Lonewolf.Entity/
RUN dotnet restore Lonewolf.WebApp/Lonewolf.WebApp.csproj
COPY . .
WORKDIR /src/Lonewolf.WebApp
RUN dotnet build Lonewolf.WebApp.csproj -c Release -o /app

FROM build AS publish
RUN dotnet publish Lonewolf.WebApp.csproj -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "Lonewolf.WebApp.dll"]
